/*
*  Copyright 2019-2020 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.modules.system.service;

import me.zhengjie.modules.system.domain.DisPartner;
import me.zhengjie.modules.system.domain.GetCurrentUserChainRequest;
import me.zhengjie.modules.system.domain.QueryDisMemberRequest;
import me.zhengjie.modules.system.domain.WxUser;
import me.zhengjie.modules.system.domain.vo.WxUserStatisticsVo;
import me.zhengjie.modules.system.service.dto.WxUserDto;
import me.zhengjie.modules.system.service.dto.WxUserQueryCriteria;
import me.zhengjie.utils.QueryHelp;
import org.springframework.data.domain.Pageable;

import java.util.Map;
import java.util.List;
import java.io.IOException;
import javax.servlet.http.HttpServletResponse;

/**
 * @author zhaoxiancheng
 * @website https://el-admin.vip
 * @description 服务接口
 * @date 2021-11-28
 **/
public interface WxUserService {

    /**
     * 查询数据分页
     *
     * @param criteria 条件
     * @param pageable 分页参数
     * @return Map<String,Object>
     */
    Map<String, Object> queryAll(WxUserQueryCriteria criteria, Pageable pageable);
    /**
     * 查询分销会员数据分页
     *
     * @param criteria 条件
     * @param pageable 分页参数
     * @return Map<String,Object>
     */
    Map<String, Object> queryDisMemberAll(QueryDisMemberRequest queryDisMemberRequest, Pageable pageable);

    /**
     * 查询所有数据不分页
     *
     * @param criteria 条件参数
     * @return List<WxUserDto>
     */
    List<WxUserDto> queryAll(WxUserQueryCriteria criteria);

    /**
     * 根据ID查询
     *
     * @param id ID
     * @return WxUserDto
     */
    WxUserDto findById(Integer id);

    /**
     * 创建
     *
     * @param resources /
     * @return WxUserDto
     */
    WxUserDto create(WxUser resources);

    /**
     * 编辑
     *
     * @param resources /
     */
    void update(WxUser resources);

    /**
     * 多选删除
     *
     * @param ids /
     */
    void deleteAll(Integer[] ids);

    /**
     * 导出数据
     *
     * @param all      待导出的数据
     * @param response /
     * @throws IOException /
     */
    void download(List<WxUserDto> all, HttpServletResponse response) throws IOException;

    /**
     * 根据ID查询
     *
     * @param openId
     * @return WxUserDto
     */
    WxUser findByOpenId(String openId);

    /**
     * 统计用户
     *
     * @return
     */
    WxUserStatisticsVo count();

    List<WxUserDto> queryAllUser(WxUserQueryCriteria criteria);

    /**
     * 根据手机号查询用户
     * @param moblie
     * @return
     */
    List<WxUser> findByMoblie(String moblie);

    /**
     * 根据姓名查询用户
     * @param city
     * @return
     */
    List<WxUser> findByCity(String city);

    /**
     * 根据手机号查询用户
     * @param moblie
     * @return
     */
    List<WxUser> findByParam(String moblie,String city);

    /**
     * 设置用户合伙人
     * @return
     */
    boolean setUserPartner(String openId, DisPartner disPartner);
    /**
     * 批量设置用户合伙人
     * @return
     */
    boolean batchSetUserPartner(List<String> openIdList, DisPartner disPartner);

    /**
     * 查询用户等级链条
     * @param openId
     * @return
     */
    List<WxUserDto.UserChain> getUserChain(String openId);

    Map<String, Object> getCurrentUserChain(GetCurrentUserChainRequest mobile, Pageable pageable);
}